package org.code.mallspringboot.controller;

import org.code.mallspringboot.pojo.SmsCouponHistory;
import org.code.mallspringboot.service.SmsCouponHistoryService;
import org.code.mallspringboot.vo.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/member/coupon")
public class SmsCouponController {

    @Autowired
    private SmsCouponHistoryService smsCouponHistoryService;
    @GetMapping("/list")
    public CommonResult list(Integer status){

        List<SmsCouponHistory> list = smsCouponHistoryService.selectByUseStatus(status);
        if (!list.isEmpty()){
            return CommonResult.success(list);
        }
        return CommonResult.failed("smsCouponHistory查询失败");
    }
}
